package k1_exercise;

import java.util.Arrays;

public class Array_merge {
    /**
     * v1={1,2,3}  v2={4,5,6} => v={1,2,3,4,5,6}
     */
    public static void main(String[] args) {

        int[] nums_a = {1,2,3};
        int[] nums_b = {4,5,6};

        //利用两个原数组的长度之和创建新数组
        int[] nums_new = new int[nums_a.length+nums_b.length];

        for (int i = 0; i < nums_new.length; i++) {
            if(i<nums_a.length){
                nums_new[i] = nums_a[i];
            }else{
                nums_new[i] = nums_b[i-nums_a.length];
            }
        }

        System.out.println(Arrays.toString(nums_new));
    }
}
